classDiagram
    class Context {
        +lookup(var: string): int
        +assign(var: string, value: int): void
    }
    
    class AbstractExpression {
        +interpret(context: Context): int
    }
    
    class TerminalExpression {
        +variable: string
        +interpret(context: Context): int
    }
    
    class NonTerminalExpression {
        +leftExpr: AbstractExpression
        +rightExpr: AbstractExpression
        +interpret(context: Context): int
    }

    AbstractExpression <|-- TerminalExpression
    AbstractExpression <|-- NonTerminalExpression

    TerminalExpression --> Context : uses
    NonTerminalExpression --> Context : uses



